<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="themes/base/jquery.ui.all.css">
<link rel="stylesheet" href="style/style.css">
<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.6.4.js">
</script>
<script src="scripts/ui/jquery.ui.core.js"></script>
<script src="scripts/ui/jquery.ui.widget.js"></script>
<script src="scripts/ui/jquery.ui.accordion.js"></script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
var data = {
		   "color": "blue", 
		   "closed": true, 
		   "payload": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
		   };
// Global variable to hold player's reference.
var _Nimbb;

// Global variable to hold the guid of the recorded video.
var _Guid = new Array();

// Event: Nimbb Player has been initialized and is ready.
function Nimbb_initCompleted(idPlayer)
{
  // Get a reference to the player since it was successfully created.
  //_Nimbb = document[idPlayer];
  _Nimbb = document[idPlayer];
}

// Event: the video was saved.
function Nimbb_videoSaved(idPlayer)
{
	 var active = $( "#accordion" ).accordion( "option", "active" );
	 alert(active);
	 // Make sure that the first player is generating this event.
	 alert("video saved with guid: "+_Nimbb.getGuid());

}
// -->
</script>
<script type="text/javascript" language="javascript" >
$(function(){
	$.each(data.payload, function(i, l) {
	     var h3 = '<h3><a href="#">'+ l + '</a></h3>';
	     $( "#accordion" ).append(h3);
	     constructDiv("question_"+i, "question_"+i,"div_"+i,"#accordion" );
	});
	$( "#accordion" ).accordion({ autoHeight: false });
	   // Document is ready
	$('#btnGetGuid_1').click(function() {
		  showGuid();
	});
	$('#btnGetGuid_2').click(function() {
		showGuid();
	});

});
function constructDiv(objectId,objectName,divId,appendToDiv){
		createDiv(divId,appendToDiv);
		createObject(objectId,objectName,"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			   ,"320","240",'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',"#"+divId);
		createParam("movie",'http://player.nimbb.com/nimbb.swf?mode=record&simplepage=1&key=487da58d96',"#"+objectId);
		createEmbed(objectId,'http://player.nimbb.com/nimbb.swf?mode=record&simplepage=1&key=487da58d96',
				"320","240","always","true",'http://www.adobe.com/go/getflashplayer',"#"+objectId);
		createParam("allowScriptAccess","always","#"+objectId);
		createParam("allowFullScreen","true","#"+objectId); 
}
function createDiv(id,appendTo){
	$('<div />', {
		id: id
	}).appendTo(appendTo);
}
function createH3(text){
	$('<h3 />', {
		text: text
	}).appendTo("body");
}
//Function to create html element of type object
function createObject(id,name,classid,width,height,codebase,appendTo){
	$('<object />', {
	    id:id,
	    name: name,
	    classid:classid,
	    width:width,
	    height:height,
	    codebase:codebase
	}).appendTo(appendTo);
}
function createParam(name,value,appendTo){
	$('<param />', {
	    name: name,
		value: value
	}).appendTo(appendTo);
}
function createEmbed(name,src,width,height,allowScriptAccess,allowFullScreen,pluginspage,appendTo){
	$('<embed />', {
	    name: name,
		src: src,
		width:width,
		height:height,
		allowScriptAccess:allowScriptAccess,
		allowFullScreen:allowFullScreen,
		pluginspage:pluginspage
	}).appendTo(appendTo);
}
</script>
<div class="demo">
<div id="accordion">
	
</div>
</div>
</body>

</html>